// +build ignore

package main

import (
	"fmt"
	base "gitee.com/liubocode/tag-for-cobra"
	"github.com/spf13/cobra"
	"log"
)

type ArgObj struct {
	StrTest  string `name:"string" shorthand:"s" desc:"test string option value" default:"testStr"`
	IntTest  int    `name:"int" shorthand:"i" desc:"test int option value" default:"1"`
	BoolTest bool   `name:"bool" shorthand:"b" desc:"test bool option value"`
}

var obj = &ArgObj{}

var rootCmd = &cobra.Command{
	Use:   "tag-for-cobra [OPTIONS]",
	Short: "example",
	Long:  `Example code for this lib.`,
	Run:   rootRun,
}

func rootRun(cmd *cobra.Command, args []string) {
	log.Println("args:", args)
	log.Println(fmt.Sprintf("obj:%+v", obj))
}

func main() {
	base.ParseExecute(obj, rootCmd)
}
